package com.wms.controller;

import com.wms.entity.WUserStore;
import com.wms.mytool.Result;
import com.wms.service.WUserStoreService;

import com.wms.vo.WUserStoreInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 用户-仓库权限表(WUserStore)表控制层
 *
 * @author Li Xiaoyu
 * @since 2023-10-20 17:21:21
 */
@RestController
@RequestMapping("/userStore")
public class WUserStoreController {
    /**
     * 服务对象
     */
    @Resource
    private WUserStoreService wUserStoreService;

    /**
     * 查询所有
     * @return 实例对象
     */
    @GetMapping("/selectAll")
    public Result selectAll(){
        return this.wUserStoreService.selectAll();
    }

    @GetMapping("/{id}")
    public Result selectByUid(@PathVariable("id") Integer id){
        return this.wUserStoreService.selectByUid(id);
    }
    /**
     * 添加仓库权限接口
     * @param wUserStore 仓库权限信息
     * @return 实例对象
     */
    @PostMapping("/addWUserStore")
    public Result addWUserStore(@RequestBody WUserStore wUserStore){
        return this.wUserStoreService.addWUserStore(wUserStore);
    }

    /**
     * 修改仓库权限接口
     * @param wUserStore 仓库权限信息
     * @return 实例对象
     */
    @PutMapping("updateWUserStore")
    public Result updateWUserStore(@RequestBody WUserStore wUserStore){
        return this.wUserStoreService.updateWUserStore(wUserStore);
    }
    @PutMapping("updateByVo")
    public Result updateByVo(@RequestBody WUserStoreInfo wUserStoreInfo){
        return this.wUserStoreService.updateByVo(wUserStoreInfo);
    }
    /**
     * 删除仓库权限接口
     * @param id 仓库权限id
     * @return 实例对象
     */
    @DeleteMapping("{id}")
    public Result deleteWUserStore(@PathVariable("id") Integer id){
        return this.wUserStoreService.deleteWUserStore(id);
    }
}

